package utils

import (
	"os"

	"gopkg.in/yaml.v3"
)

var Config GlobalConfig = GlobalConfig{}

var pwd, _ = os.Getwd()
var configPath string = pwd + "/config/config.yaml"

func init() {
	content, err := os.ReadFile(configPath)
	// fmt.Println("configpath:  " + configPath)
	// fmt.Println("content:  " + string(content))

	if err != nil {
		panic(err)
	}

	if err = yaml.Unmarshal(content, &Config); err != nil {
		panic(err)
	}

	// fmt.Printf("Config → %+v\n", Config)
	LoggerINFO("配置文件加载成功")
}

type GlobalConfig struct {
	ErineBot ErineBot `json:"erinebot" `
}

type ErineBot struct {
	APIKey    string
	SecretKey string
}
